#ifndef GITLEVENTBUS_H
#define GITLEVENTBUS_H

#include <QList>
#include "GitlDef.h"
#include "gitlevent.h"
#include "gitlmodual.h"
#include "gitlblockevtdispatcher.h"
#include "gitlnonblockevtdispatcher.h"


using namespace std;
class GitlEventBus
{
public:
    GitlEventBus();
    ~GitlEventBus();
    /*! connect a modual to the event bus
      */
    bool registerModual(GitlModual* pcModual);

    /*! disconnect a modual from the event bus
      *
      */
    bool unregisterModual(GitlModual* pcModual);

    /*! send event to event bus
      */
    void post(GitlEvent* pcEvt);


private:

    ADD_CLASS_FIELD_PRIVATE( QList<GitlModual*>, cModuals )
    ADD_CLASS_FIELD_PRIVATE( QMutex, cModualQueLocker )

    ADD_CLASS_FIELD_PRIVATE( GitlBlockEvtDispatcher, cBlockEvtDispatcher )
    ADD_CLASS_FIELD_PRIVATE( GitlNonBlockEvtDispatcher, cNonBlockEvtDispatcher )



    ///SINGLETON
    SINGLETON_PATTERN_DECLARE(GitlEventBus)

};

#endif // GITLEVTBUS_H
